package com.xs.ctl;

import org.jivesoftware.smack.packet.PacketExtension;

public class ExtensionCmdXml implements PacketExtension{

	public static final String ELEMENT = "lomo";
	public static final String NAMESPACE = "lomo:cmd";
	
	private String StrCmd = null;
	private String StrDeviceID = null;
	
	public String getCmd(){
		return StrCmd;
	}
	public void setCmd(String cmd){
		this.StrCmd = cmd;
	}
	
	public String getDeviceID(){
		return StrDeviceID;
	}
	public void setDeviceID(String value){
		this.StrDeviceID = value;
	}
	
	@Override
	public String getElementName() {
		// TODO Auto-generated method stub
		return ELEMENT;
	}

	@Override
	public String getNamespace() {
		// TODO Auto-generated method stub
		return NAMESPACE;
	}

	@Override
	public String toXML() {
		String sb = null;

		if(null != StrDeviceID && null != StrCmd ){
			sb = "<" + ELEMENT + " xmlns=\"" + NAMESPACE + "\" "+ "cmd=\"" +StrCmd + "\" " + "dev=\"" +StrDeviceID + "\"" + "/>";
		}
		return sb;
	}
	
	public static String createContinueString(String... strings) {
	    StringBuffer sb = new StringBuffer();
	    for (String string : strings) {
	        sb.append(string);
	    }
	    return sb.toString();
	}
}


